// components/house-item/house-item.js
Component({

  /**
   * 组件的属性列表
   */
  properties: {
    type: {
      type: String,
      value: 'all'
    },
    width: {
      type: Number,
      value: null
    },
    height: {
      type: Number,
      value: null
    },
    name: {
      type: String,
      value: ''
    },
    bgColor:{
      type:String,
      value:''
    }
  },

  /**
   * 组件的初始数据
   */
  data: {
    rooms: [
      {
        type: 'room',
        width: 100,
        height: 100,
        name: '房间',
        bgColor: '#f5cc98'
      },
      {
        type: 'toilet',
        width: 60,
        height: 100,
        name: '厕所',
        bgColor: '#4fdff8'
      },
      {
        type: 'kitchen',
        width: 60,
        height: 100,
        name: '厨房',
        bgColor: '#ffa4a4'
      },
      {
        type: 'balcony',
        width: 100,
        height: 60,
        name: '阳台',
        bgColor: '#bffc70'
      },
      {
        type:'customer',
        width: 100,
        height: 60,
        name: '自定义',
        bgColor: '#8e77eb'
      }
    ]
  },

  /**
   * 组件的方法列表
   */
  methods: {
    onTapRoom(e) {
      // console.log(e);
      let type = e.currentTarget.dataset.type
      let size = e.currentTarget.dataset.size
      let obj = {
        type:type,
        size:size
      }
      this.triggerEvent('dataItem', obj)
    }
  },


  // 生命周期
  lifetimes: {
    created: function () {
      // console.log(this.properties.type);
    }
  }
})